﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MH3GAPP.Bll;
using MH3GAPP.Dal;

namespace MH3GAPP.Frm
{
    public partial class DamageForm : Form
    {
        #region var_全局变量
        private static DamageForm instance;
        private MH3GBll mh3gBll = new MH3GBll();
        private string damageStr = "";

        int startID = 16;

        string outStr = "";
        int allDamage = 0;
        int damageCount = 0;
        double damage = 0.0;
        #endregion

        #region Constructor_构造函数
        private DamageForm()
        {
            InitializeComponent();
        }
        #endregion

//         #region Destructor_析构函数
//         ~DamageForm()
//         {
//         }
//         #endregion

        #region GetInstance_取得实例
        public static DamageForm GetInstance()
        {
            if (instance == null)
            {
                instance = new DamageForm();
            }
            return instance;
        }
        #endregion

        private void DamageForm_Load(object sender, EventArgs e)
        {
            label4.Text = "";
            label5.Text = "";
            label6.Text = "";
        }

        private void but1_Click(object sender, EventArgs e)
        {
            outStr += "踏步斩 → ";
            textBox.Text = outStr;
            allDamage += 26;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();
        }

        private void but2_Click(object sender, EventArgs e)
        {
            outStr += "纵斩 → ";
            textBox.Text = outStr;
            allDamage += 23;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();
        }

        private void but3_Click(object sender, EventArgs e)
        {
            outStr += "突刺 → ";
            textBox.Text = outStr;
            allDamage += 14;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();
        }

        private void but4_Click(object sender, EventArgs e)
        {
            outStr += "上挑 → ";
            textBox.Text = outStr;
            allDamage += 18;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();
        }

        private void but5_Click(object sender, EventArgs e)
        {
            outStr += "袈裟斩 → ";
            textBox.Text = outStr;
            allDamage += 24;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();
        }

        private void but6_Click(object sender, EventArgs e)
        {
            outStr += "气刃斩1 → ";
            textBox.Text = outStr;
            allDamage += 28;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();
        }

        private void but7_Click(object sender, EventArgs e)
        {
            outStr += "气刃斩2 → ";
            textBox.Text = outStr;
            allDamage += 30;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();
        }

        private void but8_Click(object sender, EventArgs e)
        {
            outStr += "气刃斩3 → ";
            textBox.Text = outStr;
            allDamage += 60;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();
        }

        private void but9_Click(object sender, EventArgs e)
        {
            outStr += "气刃斩4 → ";
            textBox.Text = outStr;
            allDamage += 42;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();
        }

        private void but0_Click(object sender, EventArgs e)
        {
            outStr += "无气气刃斩 → ";
            textBox.Text = outStr;
            allDamage += 16;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();
        }

        private void resetBut_Click(object sender, EventArgs e)
        {
            outStr = "";
            textBox.Text = outStr;
            allDamage = 0;
            damageCount = 0;
            damage = 0.0;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            outStr += "△ → ";
            textBox.Text = outStr;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();

            damageStr += "1";
        }

        private void button2_Click(object sender, EventArgs e)
        {
            outStr += "○ → ";
            textBox.Text = outStr;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();

            damageStr += "2";
        }

        private void button3_Click(object sender, EventArgs e)
        {
            outStr += "△+○ → ";
            textBox.Text = outStr;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();

            damageStr += "4";
        }

        private void button4_Click(object sender, EventArgs e)
        {
            outStr += "R → ";
            textBox.Text = outStr;
            damageCount++;
            damage = allDamage / damageCount;
            label4.Text = allDamage.ToString();
            label5.Text = damageCount.ToString();
            label6.Text = damage.ToString();

            damageStr += "3";
        }

        private void DamageForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            instance = null;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            mh3gBll.inputDamage(startID, allDamage);
            startID++;
            resetBut_Click(null, null);
        }
    }
}
